﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using Axis.BusinessObject.Research;
using System.Web.Script.Serialization;
using Axis.Dao.Research;
using Axis.Web.Administrator.Global;

namespace Axis.Web.Administrator.Views.Lottory.Services
{
    /// <summary>
    /// Summary description for AxisLottery
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class AxisLottery : System.Web.Services.WebService
    {

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetListMember(int ProjectID)
        {
            string Context = "";
            string InputValue = string.Format("<InputValue ProjectID=\"{0}\" Type=\"{1}\" {2}/>", ProjectID, 0, Context);
            IList<CUserResponse> Map = (new CResearchDao()).GetProjectResponseExportInObject(InputValue);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }
        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string SetCurrentResult(string LuckyName, string LuckyNumber, string TimeWait, string LuckyGift, string ProjectName)
        {

            if (CSecurity.USER_ID == 0)
                return new JavaScriptSerializer().Serialize(new
                {
                    isSuccess = false,
                    Description = "Không có session",
                });
            CurrentInfo.LuckyNumber = LuckyNumber;
            CurrentInfo.LuckyName = LuckyName;
            CurrentInfo.TimeWait = TimeWait;
            CurrentInfo.LuckyGift = LuckyGift;
            CurrentInfo.ProjectName = ProjectName;
            string output = new JavaScriptSerializer().Serialize(new
            {
                isSuccess = false,
                Description = "OK",
            });
            return output;
        }
    }
}
